/*
 * thread.h
 *
 *  Created on: 2016年2月24日
 *      Author: zxy
 */

#ifndef CORE_SOURCES_THREAD_THREAD_POOL_THREAD_POOL_WORKER_H_
#define CORE_SOURCES_THREAD_THREAD_POOL_THREAD_POOL_WORKER_H_
#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>
#include <boost/noncopyable.hpp>
#include "../conf/def.h"
namespace eyas {
namespace thread {

class thread_pool;
class EYAS_THREAD_API thread_pool_worker : public boost::noncopyable {
public:
	thread_pool_worker(thread_pool *thpool);
	virtual ~thread_pool_worker();

private:
	thread_pool *thread_pool_;
	bool enable_;
	boost::thread thread_;
public:
	boost::thread::id get_thread_id(){return this->thread_.get_id();}
	bool enabled(){return this->enable_;}
	void set_enable(bool enable){ this->enable_ = false; }
private:
	void thread_proc();
};
typedef boost::shared_ptr<thread_pool_worker> thread_pool_worker_ptr;

}
}
#endif /* CORE_SOURCES_THREAD_THREAD_POOL_THREAD_POOL_WORKER_H_ */
